home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / archiver / catoz.zip / CATOZ.BAT next >
DOS Batch File  |  1989-06-18  |  3KB  |  131 lines

  1. echo off
  2. echo  
  3. echo Convert Arc TO Zip procedure. 6-18-1989 13:14:12
  4.  
  5. REM     by Alex Janssen
  6. REM     GENIE a.janssen1
  7.  
  8. if %1z==z goto USAGE
  9. if not exist %1.ARC goto NOTEXIST
  10. if exist %1.ZIP goto ZIPEXIST
  11. goto PROCESS
  12.  
  13. :NOTEXIST
  14. echo File "%1.ARC" not found.
  15. goto EXIT1
  16.  
  17. :USAGE
  18. echo  
  19. echo USAGE IS  catoz [path\]filename
  20. echo  
  21. echo [path\] is optional and is only necessary if the file to be converted
  22. echo is not on the current default directory.
  23. echo  
  24. echo DO NOT include the file name extension, .ARC for the filename.
  25. echo  
  26. echo If you do not have the program PKUNPAK by PKware you will have to edit
  27. echo this batch file and change the pkunpak command to the appropriate command
  28. echo to unpack your compressed file libraries to the temporary directory created
  29. echo for the unpacked files.
  30. echo  
  31. goto EXIT1
  32.  
  33. :ZIPEXIST
  34. echo "%1.ZIP" already exists.
  35. goto EXIT1
  36.  
  37. :PROCESS    The conversion is performed here.
  38. REM    Make a temporary directory for the unarchived files to 
  39. REM    reside in.
  40. md $$catoz$
  41.  
  42. REM    Unpack the compressed files into the new directory and 
  43. REM    test for an error. Alternate command for unpacking with 
  44. REM    SEA's ARC.  Delete the pkunpak ... line and remove the 
  45. REM    REM in front of the arc ... line.
  46.  
  47. REM arc %1 $$catoz$\*.*
  48. pkunpak %1 $$catoz$
  49. if errorlevel 1 goto EXIT2
  50.  
  51. REM    Recompress the files into the new ZIP format and delete 
  52. REM    uncompressed copies. /ex parameter is available only with 
  53. REM    version 0.92 and newer of PKZIP.
  54.  
  55. pkzip /om /ex2 %1 $$catoz$\*.*
  56. if errorlevel 16 goto err16
  57. if errorlevel 15 goto err15
  58. if errorlevel 14 goto err14
  59. if errorlevel 13 goto err13
  60. if errorlevel 12 goto err12
  61. if errorlevel 4 goto err4-11
  62. if errorlevel 2 goto err2-3
  63. if errorlevel 1 goto err1
  64.  
  65. REM    Clean up.
  66. REM    Remove the temporary directory if all went well.
  67.  
  68. rd $$catoz$
  69.  
  70. REM    Display both ARC and ZIP versions for the sake of 
  71. REM    comparison.
  72. dir %1.*
  73.  
  74. REM    Test for existance of new ZIP file and display error 
  75. REM    message if not there.
  76. if not exist %1.ZIP goto EXIT3
  77.  
  78. REM    Delete the old ARC version only if the new ZIP version 
  79. REM    was created.
  80. del %1.ARC
  81. echo Conversion of %1.ARC to %1.ZIP complete.
  82.  
  83. goto EXIT1
  84.  
  85.  
  86. REM    PKZIP returned error code translation.
  87. :err1
  88. echo     Bad file name or file specification.
  89. goto EXIT2
  90.  
  91. :err2-3
  92. echo     Error in ZIP file.
  93. goto EXIT2
  94.  
  95. :err4-11
  96. echo     Insufficient Memory.
  97. goto EXIT2
  98.  
  99. :err12
  100. echo     No files were found to add to the ZIP file,
  101. echo    or no files were specified for deletion.
  102. goto EXIT2
  103.  
  104. :err13
  105. echo     File not found.  The specified ZIP file
  106. echo     or list file was not found.
  107. goto EXIT2
  108.  
  109. :err14
  110. echo     Disk full.
  111. goto EXIT2
  112.  
  113. :err15
  114. echo     ZIP file is read-only and can not be modified.
  115. goto EXIT2
  116.  
  117. :err16
  118. echo     Bad or illegal parameters specified.
  119. goto EXIT2
  120.  
  121. :EXIT3
  122. echo  
  123. echo The new ZIP file was not created.
  124.  
  125. :EXIT2
  126. echo   E R R O R   O C C U R R E D
  127. echo The next key press will exit this batch procedure.
  128. pause
  129.  
  130. :EXIT1
  131.